Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/7.0] Fix to #29279 - EF7 - GroupBy on Json column property + First/FirstOrDefault generates incorrect SQL #29288

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Oct 7, 2022

Problem was that in VisitChildren for JsonQueryExpression we were not passing key columns stored in _keyPropertyMap thru the visitor, so the aliases got out of sync. Fix is to process these key columns also and then update the JsonQueryExpression with new map if any of the columns have been modified by the visitor.

Fixes #29279

Customer impact

Exception in a relatively simple GroupBy + paging scenario involving new JSON mapping feature.

How found

Found by a customer testing EF7 bits.

Regression

No, this is in the new feature.

Testing

New testing added for the reported scenario and additional cases around it.

Risk

Low, only affects JSON scenarios (code change is in the new class that only gets created to traverse JSON expressions). It should be safe to pass key columns through the visitor - we already do that for the JSON column. Could be unnecessary work, but safe.

@maumar maumar requested review from smitpatel and roji October 7, 2022 01:08
…Default generates incorrect SQL

Problem was that in VisitChildren for JsonQueryExpression we were not passing key columns stored in _keyPropertyMap thru the visitor, so the aliases got out of sync.
Fix is to process these key columns also and then update the JsonQueryExpression with new map if any of the columns have been modified by the visitor.

Fixes #29279
@maumar maumar merged commit 245f23d into release/7.0 Oct 7, 2022
@maumar maumar deleted the fix29279 branch October 7, 2022 18:17
@ajcvickers ajcvickers removed this from the 7.0.0 milestone Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants